location = /error_pages/404.html {
internal;
root /var/www/html;
}
location = /error_pages/502.html {
internal;
root /var/www/html;
}
location / {
proxy_pass........
error_page 404 = /error_pages/404.html;
error_page 502 = /error_pages/502.html;
}